import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;

public class Main {

}

class Account {
	private int balance;
	private Lock Lock;
	private Condition Funds;

	public Account(int balance) {
		super();
		this.balance = balance;
	}

	public int getBalance() {
		return balance;
	}

	public void setBalance(int balance) {
		this.balance = balance;
	}

	public synchronized void deposit(int money) {
		setBalance(getBalance() + money);
		Funds.signalAll();
	}

	public synchronized void withdraw(int money) {
		while (getBalance() <= 0) {
			try {
				Funds.await();
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		setBalance(getBalance() - money);
		Funds.signalAll();

	}
}